<?php 
include '../utils/stock.php';
include '../utils/evaluator.php';
require('../utils/fpdf17/fpdf.php');
session_start() ;
?>
<html>
<head>
<style type="text/css">
body
{

font-family:"Calibri";}
}
</style>
</head>
<body>

<b>Debt on Equity and Current Ratio (2 of 2)</b>
<br>

<br>
Figures saved.
<?php


$debt = $_POST["debt"];
$equity = $_POST["equity"];
$de = $debt/$equity;
$assets = $_POST["cassets"];
$liabilities = $_POST["cliabilities"];
$tassets = $_POST["assets"];
$tliabilities = $_POST["liabilities"];
$property = $_POST["property"];
$ebit = $_POST["ebit"];
$cr = $assets/$liabilities;

$evaluator = $_SESSION['evaluator'];
$evaluator->total_debt = $debt;
$evaluator->total_equity = $equity;
$evaluator->debt_on_equity = $de;
$evaluator->current_liabilities = $liabilities;
$evaluator->current_assets = $assets;
$evaluator->total_liabilities = $tliabilities;
$evaluator->total_assets = $tassets;
$evaluator->current_ratio = $cr;
$evaluator->net_fixed_assets = $property;
$evaluator->ebit = $ebit;
$_SESSION['evaluator'] = $evaluator;

//echo "<b>Total debt: </b>";
//echo $debt;
//echo "<br>";
//echo "<b>Total equity: </b>";
//echo $equity;
//echo "<br>";
//echo "<b>Total current assets: </b>";
//echo $assets;
//echo "<br>";
//echo "<b>Total current liabilities: </b>";
//echo $liabilities;
//echo "<br>";
//echo "<b>Net fixed assets: </b>";
//echo $property;
//echo "<br>";
//echo "<b>EBIT: </b>";
//echo $ebit;
//echo "<br>";
//echo "<br>";
//echo "<b>Debt/Equity: </b>";
//echo  "".addColor($de, 0.5)."";
//echo "<br>";
//echo "<b>Current ratio: </b>";
//echo  "".addColorBigger($cr, 1)."";
//echo "<br>";
//echo "<br>";
//echo "Proceed if these numbers are correct, otherwise go back.";



function addColor($number, $reference){
	if($number <= $reference) 
	{
		$res = "<b><font color='green'>". $number . "</font></b>";
	}
	else 
	{
		$res = "<font color='red'>". $number . "</font>";
	}
	
	return $res;
}
function addColorBigger($number, $reference){
	if($number >= $reference) 
	{
		$res = "<b><font color='green'>". $number . "</font></b>";
	}
	else 
	{
		$res = "<font color='red'>". $number . "</font>";
	}
	
	return $res;
}
?>
<br />
<button type="button" onclick="location.href='step2.php'">Back</button>
<button type="button" onclick="location.href='step3.php'">Next</button>



</body>
</html> 